//
//  LandmarkRow.swift
//  Landmarks
//
//  Created by yafei li on 2024/6/17.
//

import SwiftUI

struct LandmarkRow: View {
    
    var landmark: Landmark
    
    var body: some View {
        HStack {
            landmark.image.resizable()
                .frame(width: 50,height: 50)
                .clipShape(RoundedRectangle(cornerRadius: 3.0))
                
            
            VStack(alignment: .leading) {
                Text(landmark.name)
                    .bold()
               
               #if !os(watchOS)
               Text(landmark.park)
                   .font(.caption)
                   .foregroundStyle(.secondary)
               #endif
            }
            
            Spacer()
            
            if landmark.isFavorite {
                          Image(systemName: "star.fill")
                    .foregroundStyle(.yellow)
                      }
        }
        .padding(.vertical,4)
    }
}

#Preview {
    Group {
        LandmarkRow(landmark: ModelData().landmarks[0])
        LandmarkRow(landmark: ModelData().landmarks[1])
    }
}
